package com.isfto.controller;


import com.isfto.entity.R;
import com.isfto.entity.tablepojo.ABRS;
import com.isfto.entity.tablepojo.FlightChange;
import com.isfto.entity.tablepojo.PageBean;
import com.isfto.service.AbrsService;
import com.isfto.service.FlightChangeEnterService;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/apply")
public class FlightChangeEnterController {
    @Resource
    FlightChangeEnterService flightChangeService;

    @Resource
    AbrsService abrsService;

    @PostMapping("/enter")
    public R<Object> saveInfo(@RequestBody FlightChange flightChange) {
        int total= flightChangeService.saveInfo(flightChange);
        return R.success(null);
    }
    @PostMapping("/upenter")
    public R beforeInfoEnter(@RequestBody FlightChange flightChange){
        FlightChange flightChange1 = flightChangeService.beforeInfoEnter(flightChange);
        return R.success(null);
    }
    @PostMapping("/returnenter")
    public R changeBeforeInfoEnter(@RequestBody FlightChange flight) {
        FlightChange flightChange = flightChangeService.changeBeforeInfoEnter(flight);
        return R.success(null);
    }
    @PutMapping("/status")
    public R updateStauts(@RequestBody FlightChange flightChange) {
        System.out.println(flightChange);
       int i = flightChangeService.updateStauts(flightChange);
        return R.success(null);
    }
    @GetMapping("/inform")
    public R flightChange(Integer page,Integer pageSize,Integer flag) {
        PageBean pageBean = flightChangeService.flightChange(page,pageSize,flag);
        return R.success(pageBean);
    }

    @GetMapping("/choiceinform")
    public R flightChangeInfo(String startapcd, String endapcd, String startfptt, String endfplt, Integer page, Integer pageSize,Integer flag) {
        PageBean pageBean = flightChangeService.flightChangeInfo(startapcd, endapcd, startfptt, endfplt, page, pageSize,flag);
        return R.success(pageBean);
    }

    @GetMapping("/exceptionreasonenter")
    public List<ABRS> abrsOutInfo() {
        List<ABRS> abrs =abrsService.abrsOutInfo();
        return abrs;
    }
}
